#ifndef SRC_INTEL_ITT_WRAPPER
#define SRC_INTEL_ITT_WRAPPER

#ifdef USE_INTEL_ITT

#include "ittnotify.h"

// Create a domain that is visible globally
#define INTEL_ITT_DOMAIN_CREATE(domain, domain_create)                         \
  __itt_domain *domain = __itt_domain_create(domain_create)

// Create string handles which associates with the "handle_create" task.
#define INTEL_ITT_STRING_HANDLE_CREATE(handle, handle_create)                  \
  __itt_string_handle *handle = __itt_string_handle_create(handle_create)

// Create a task associated with the "handle" routine.
#define INTEL_ITT_TASK_BEGIN(domain, handle)                                   \
  __itt_task_begin(domain, __itt_null, __itt_null, handle)

// Mark the end of the main task
#define INTEL_ITT_TASK_END(domain) __itt_task_end(domain)

// Run the application without collecting data. VTune Profiler reduces the
// overhead of collection, by collecting only critical information, such as
// thread and process creation.
#define INTEL_ITT_PAUSE __itt_pause()

// Resume data collection. VTune Profiler resumes collecting all data.
#define INTEL_ITT_RESUME __itt_resume()

// Detach data collection. VTune Profiler detaches all collectors from all
// processes. Your application continues to work but no data is collected for
// the running collection.
//! Only the last call
#define INTEL_ITT_DETACH __itt_detach()

#else

// Empty Marcos
#define INTEL_ITT_DOMAIN_CREATE(domain, domain_create)
#define INTEL_ITT_STRING_HANDLE_CREATE(handle_main, handle_main_create)
#define INTEL_ITT_TASK_BEGIN(domain, handle)
#define INTEL_ITT_TASK_END(domain)
#define INTEL_ITT_PAUSE
#define INTEL_ITT_RESUME
#define INTEL_ITT_DETACH
#endif

#endif /* SRC_INTEL_ITT_WRAPPER */
